<?php
$db = new Database;
$auth = Auth::getAuth('current_user');
$user_id = $auth['id'];
$company_id = $auth['company_id'];
$data = "";
$timezone = "Asia/Manila";
if(function_exists('date_default_timezone_set')) date_default_timezone_set($timezone);
if(isset($_POST['action'])){
    $arrayData = explode(",",implode(",",$_POST['arrayData']));
    $form_id = $_POST['activeFormForRequest'];
    for($a=0;$a<count($arrayData);$a++){
        $data.=$arrayData[$a]."~";
    }
    $insertRequest = array(
            "user_id"=>$user_id,
            "company_id"=>$company_id,
            "form_id"=>$form_id,
            "data"=>$data,
            "status"=>0,
            "date"=>date("Y-m-d"),
    );
    $request_id = $db->insert("tbrequest",$insertRequest);
    echo $request_id;
}
?>